package de.haw.shc.Room;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;
import de.haw.shc.Config.SHC_List_Adapter;
import de.haw.shc.Config.XML_Reader;
import de.haw.shc.Interfaces.DeviceProperty.Device;
import de.haw.shc.R;

import java.util.List;


/**
 * Created with IntelliJ IDEA.
 * User: mizus
 * Date: 11.06.13
 * Time: 12:43
 * To change this template use File | Settings | File Templates.
 */
public class RoomItemFragment extends Fragment {

    private ExpandableListView expandableListView;
    private Bundle bundle;
    private String name;


    public RoomItemFragment(){
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        View view = inflater.inflate(R.layout.viewlist, container, false);
        XML_Reader xml_reader = XML_Reader.createXMLReader(getResources());

        List<Device> roomList = xml_reader.getRaumMap().get(getArguments().getString("Room"));

        expandableListView = (ExpandableListView) view.findViewById(R.id.ex_list);
        expandableListView.setAdapter(new SHC_List_Adapter(getActivity(), roomList));
        return view;
    }

    private void out(String str){
        System.out.println(str);
    }





}
